package com.gp.test.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * 代理人，中介
 *
 * @author
 * @create 2017-05-21 19:39
 */
public class Agent implements InvocationHandler {
	private Person person;

	public Agent(Person person) {
		this.person = person;
	}

	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
		System.out.println("执行前增强");
		Object result = method.invoke(this.person, args);
		System.out.println("执行后增强");
		return result;
	}
}
